home *** CD-ROM | disk | FTP | other *** search
/ Scene 96 / Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso / misc / coding / midas060 / samples / midpnt / midplist.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-22  |  905 b   |  59 lines

  1. /*
  2.  *      MidpList.cpp
  3.  *
  4.  * MIDAS Module Player for Windows NT List class definitions
  5.  *
  6.  * Copyright 1996 Petteri Kangaslampi
  7. */
  8.  
  9.  
  10. #include <stdlib.h>
  11. #include "MidpList.h"
  12.  
  13. midpList::midpList(void)
  14. {
  15.     first = current = new midpListItem;
  16.     first->next = first->prev = first;
  17. }
  18.  
  19.  
  20. midpList::~midpList(void)
  21. {
  22.     delete first;
  23. }
  24.  
  25.  
  26. void midpList::AddItem(midpListItem *item)
  27. {
  28.     item->next = first->next;
  29.     item->prev = first;
  30.     first->next->prev = item;
  31.     first->next = item;
  32. }
  33.  
  34.  
  35.  
  36. void midpList::RemoveItem(midpListItem *item)
  37. {
  38.     item->next->prev = item->prev;
  39.     item->prev->next = item->next;
  40. }
  41.  
  42.  
  43.  
  44.  
  45. midpListItem *midpList::GetFirst(void)
  46. {
  47.     current = first;
  48.     return GetNext();
  49. }
  50.  
  51.  
  52.  
  53. midpListItem *midpList::GetNext(void)
  54. {
  55.     current = current->next;
  56.     if ( current != first )
  57.         return current;
  58.     return NULL;
  59. }